package com.zzj.controller;

import com.github.pagehelper.PageInfo;
import com.zzj.bean.InboxBean;
import com.zzj.service.InboxService;
import com.zzj.utils.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api
//@CrossOrigin
@RequestMapping("inbox")
public class InboxController {

    @Autowired
    private InboxService inboxService;

    @GetMapping("findAll")
    public PageInfo<InboxBean> findAll(
            @RequestParam(defaultValue = "1") int pageNum,
            @RequestParam(defaultValue = "5") int pageSize
    ){
        return inboxService.findAll(pageNum,pageSize);
    }

    @PostMapping("addInbox")
    public Result addInbox(@RequestBody InboxBean inboxBean){
        System.out.println("inboxBean = " + inboxBean);
        return inboxService.addInbox(inboxBean);
    }
}
